package com.audio.context;


public class BaseContext {
    public static ThreadLocal<Long> userIdThreadLocal = new ThreadLocal<>();
    public static ThreadLocal<Integer> userRoleThreadLocal = new ThreadLocal<>();

    public static void setCurrentUserId(Long userId) {
        userIdThreadLocal.set(userId);
    }
    public static Long getCurrentUserId() {
        return userIdThreadLocal.get();
    }
    public static void clearCurrentUserId() {
        userIdThreadLocal.remove();
    }

    public static void setCurrentUserRole(Integer identity){
        userRoleThreadLocal.set(identity);
    }

    public static Integer getCurrentUserRole(){
        return userRoleThreadLocal.get();
    }
    public static void clearCurrentUserRole() {
        userRoleThreadLocal.remove();
    }

}
